﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using MySql.Data.MySqlClient;

namespace QD.Data.Parameter
{
    public class MySqlParamBuilder : IDBPramaBuilder
    {
        public IDbDataParameter Create(string name, object value = null)
        {
            return Create(name, value, ParameterDirection.Input);
        }

        public IDbDataParameter Create(string name, object value, ParameterDirection direction)
        {
            MySqlParameter param = new MySqlParameter() { ParameterName = name, Value = value ?? DBNull.Value, Direction = direction };
            return param;
        }

        public IDbDataParameter Create(string name, object value, DbType type)
        {
            return Create(name, value, ParameterDirection.Output, type);
        }

        public IDbDataParameter Create(string name, object value, ParameterDirection direction, DbType type)
        {
            MySqlParameter param = new MySqlParameter() { ParameterName = name, Value = value ?? DBNull.Value, Direction = direction };
            return param;
        }

    }
}
